#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>

namespace Ui {
class MainWindow;
}

enum InputBase {
    Base_10,
    Base_16,
    Base_2
};

enum CustomOperator {
    Operator_Init,
    Operator_Add,
    Operator_Sub,
    Operator_Multiply,
    Operator_Divide,
    Operator_Yu,
    Operator_Huo,
    Operator_Fei,
    Operator_YiHuo
};

static QStringList operatorList = {
    "空", "+", "-", "*", "/", "与", "或", "非", "异或"
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_radioButton_clicked();

    void on_radioButton_2_clicked();

    void on_radioButton_3_clicked();

    void on_lineEdit_textEdited(const QString &arg1);

    void on_lineEdit_2_textEdited(const QString &arg1);

    void on_lineEdit_3_textEdited(const QString &arg1);

    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_21_clicked();

    void on_pushButton_22_clicked();

    void on_pushButton_18_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_20_clicked();

    void on_pushButton_19_clicked();

    void on_pushButton_23_clicked();

    void on_pushButton_24_clicked();

    void on_pushButton_25_clicked();

    void on_pushButton_26_clicked();

    void on_pushButton_27_clicked();

private:
    Ui::MainWindow *ui;
    InputBase m_inputBase;
    unsigned int m_currentValue;
    unsigned int m_firstValue;
    CustomOperator m_customOperator;
    int m_index;    //当前输入第几个数
    QTimer* m_timer;

    void init();
    void updateBtnState(InputBase base);
    void inputHardKey(QString key);
    void changeBaseToOtherBase(QString value);
    void readyForInputSecond();
};

#endif // MAINWINDOW_H
